//
//  Datetime.h
//  CalendarTest
//
//  Created by mac on 13-8-27.
//  Copyright (c) 2013年 caobo. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface Datetime : NSObject
//所有年列表
+(NSArray *)GetAllYearArray;

//所有月列表
+(NSArray *)GetAllMonthArray;



//获取指定年份指定月份的星期排列表
+(NSArray *)GetDayArrayByYear:(int) year
                     andMonth:(int) month;

//获取指定年份指定月份的星期排列表(农历)
+(NSArray *)GetLunarDayArrayByYear:(int) year
                          andMonth:(int) month;

//获取某年某月某日的对应农历
+(NSString *)GetLunarDayByYear:(int) year
                      andMonth:(int) month
                        andDay:(int) day;


//以YYYY-MM-dd格式输出年月日
+(NSString*)getDateTime;

//以YYYY年MM月dd日格式输出年月日
+(NSString*)GetDateTime;

//以YYYY年MMdd格式输出此时的农历年月日
+(NSString*)GetLunarDateTime;

+(NSString *)GetYear;
+(NSString *)GetYearWithDate:(NSDate*)aDate;

+(NSString *)GetMonth;
+(NSString *)GetMonthWithDate:(NSDate*)aDate;

+(NSString *)GetDay;
+(NSString *)GetDayWithDate:(NSDate*)aDate;

+(NSString *)GetHour;
+(NSString *)GetHourWithDate:(NSDate*)aDate;

+(NSString *)GetMinute;

+(NSString *)GetSecond;

+(NSString*)GetTimeFormate:(NSDate*)timeDate;
+(NSDate*)GetDateWithString:(NSString*)timeString;
+(NSDate*)GetDateWithString:(NSString*)timeString format:(NSString *)format;

+ (NSDate*)getDateWithFormate:(NSString*)timeFormate;
+ (NSString*)getStringWithFormate:(NSString*)timeFormate;
+ (NSDate*)getTomorrowDateWithDate:(NSDate*)aDate;
+ (NSDate*)getYestodayDateWithDate:(NSDate*)aDate;

//输入date 输入特定格式时间字符串
+(NSString *)dateStringWithDate:(NSDate *)date DateFormat:(NSString *)dateFormat;
//输入时间戳，输入特定格式时间字符串
+(NSString *)dateStringWithtimeSp:(NSString *)timeSp DateFormat:(NSString *)dateFormat;
//后台返回的时间戳，/1000.
+ (NSString *)dateStringWithDateStr:(NSString *)dateStr DateFormat:(NSString *)dateFormat;

/**
  几天前，几小时前，几分钟前

 @param dateStr 后台返回的时间戳（10位）
 @return 结果
 */
+ (NSString *)dealTimeDifference:(NSString *)dateStr;

// 判断两个日期的大小
+ (int)compareDateWithSelectDate:(NSString *)selectDate;
+ (int)compareDateWithcurrentDate:(NSDate*)currentDate withSelectedDate:(NSDate*)selectedDate withDateFormat:(NSString *)dateFormat;

//获得当前时间的时间戳
+ (NSString*)getCurrentTimestamp;

//获取周几
+(NSString*)weekdayStringFromDate:(NSDate*)inputDate;

/**
 判断开始时间于结束时间是否负责规则,YES为符合规则
 
 @param startTime 开始时间，格式yyyy/MM/dd HH:mm字符串
 @param endTime 结束时间，格式yyyy/MM/dd HH:mm字符串
 @return 是否负责规则
 */
+ (BOOL)compareTimeWithStartTime:(NSString *)startTime andEndTime:(NSString *)endTime;

/* 获取当前时间  -- 返回值:string
   @param format:  时间显示形式  @"yyyy/MM/dd"
 */
+ (NSString *)currentTimeString:(NSString *)format;


// 获取当前时间之后 x小时的时间
+ (NSString *)getTimeAfterHours:(NSInteger)hours format:(NSString *)format;

/**
 是否为今天的日期

 @param date 传入的日期
 @return 是否为今天
 */
+(BOOL)isToday:(NSDate *)date;


// 时间转时间戳
+ (NSString *)transToTimeSp:(NSString *)time dateFormate:(NSString *)format;

//以天为单位的向前向后偏移的时间
+ (NSDate*)getDateWithDateOffset:(NSInteger )offset;


@end
